package com.core.model.lxf;

import com.core.model.AbstractEntity;
import com.core.model.enumType.WorkOverTimeEnum;
import com.core.shared.DateTimeUtils;

import javax.persistence.*;

/**
 * Created with IntelliJ IDEA.
 * User: lxf
 * Date: 2017/2/17
 * Time: 14:34
 * To change this template use Editor | File and Code Templates.
 */
@Entity
@Table(name = "work_over_time")
public class WorkOverTime extends AbstractEntity {

    @Column(name = "start_time")
    private String startTime;
    @Column(name = "end_time")
    private String endTime;
    @Column(name = "work_type")
    @Enumerated(EnumType.STRING)
    private WorkOverTimeEnum workType;
    private String remark;

    public WorkOverTime() {
    }

    public WorkOverTime(String startTime, String endTime, WorkOverTimeEnum workType, String remark) {
        this.startTime = startTime;
        this.endTime = endTime;
        this.workType = workType;
        this.remark = remark;
    }

    public void init(WorkOverTime workOverTime) {
        this.startTime = workOverTime.startTime();
        this.endTime = workOverTime.endTime();
        this.workType = workOverTime.workType();
        this.remark = workOverTime.remark();
        setUpdateTime(DateTimeUtils.getLocalDateTime());
    }

    public String startTime() {
        return startTime;
    }

    public String endTime() {
        return endTime;
    }

    public WorkOverTimeEnum workType() {
        return workType;
    }

    public String remark() {
        return remark;
    }
}
